Implement discovery loop in python#1069
Merged
igaw merged 3 commits intolinux-nvme:masterfrom Sep 9, 2025
Merged
Conversation
The python 'with' statement allows for correct resource tracking, where the allocated resource will be freed at the end of the statement. This is helpful for 'host', 'subsystem', and 'controller' objects which we might want to clean up (and clear out the internal tree). The nice thing here is that we can do an automatic controller disconnect, and don't have to worry about leaving stale connections or objects around. Signed-off-by: Hannes Reinecke <[email protected]>
Now that we have resource tracking we can use the 'with' statement for discovery and clean up connections and discovery controllers on exit. Signed-off-by: Hannes Reinecke <[email protected]>
As we now have resource tracking we can implement a discovery loop in python without leaving stale controllers around. Signed-off-by: Hannes Reinecke <[email protected]>
Collaborator
|
Nice! Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that we have fixed up the python bindings we can implement the command 'discovery-all' in python, serving as an example how 'connect-all' can be implemented.